/**
  ******************************************************************************
  * @author     Chris
  * @since      2024/6/28 15:35
  *
  * @file       pd_wdg.h
  * @brief      Header file of Xxx hardware driver.
  *
  * @note       This file contains the Xxx object declaration.
  *
  * @warning    None.
  ******************************************************************************
  * Change Logs:
  *   Date          Author       Notes
  *   2024/6/28     Chris        the first version
  *
  ******************************************************************************
  */


#ifndef JLC_SKY_WDG_H
#define JLC_SKY_WDG_H

#include "stm32f407xx.h"

struct WDGVtbl;

/** @defgroup Object properties
  * @{
  */
typedef struct {

    // WDG virtual table
    struct WDGVtbl* vptr;
} WDG;
/**
 * @}
 */

/** @defgroup Object virtual table definition
  * @{
  */
struct WDGVtbl {
    void (*init)(const WDG *this);

    void (*feed_dogs)(const WDG *this);

    uint32_t (*is_reset)(const WDG *this);
};
/**
 * @}
 */

/** @defgroup Object constructor and member function declaration
  * @{
  */
void WDG_constructor(WDG *this);
/**
 * @}
 */

/** @defgroup Object virtual table function implementation
  * @{
  */
static inline void WDG_init(const WDG *this) {
    this->vptr->init(this);
}

static inline void WDG_feedDogs(const WDG *this) {
    this->vptr->feed_dogs(this);
}

static inline uint32_t WDG_isReset(const WDG *this) {
    return this->vptr->is_reset(this);
}
/**
 * @}
 */

#endif //JLC_SKY_WDG_H
